// 获取一组数的平均值
const average = (...args) => args.reduce((a, b) => a + b) / args.length
console.log(average(1, 2, 3, 4, 5)) // 3

// 获取两个整数之间的随机整数
const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min)
console.log(random(45, 50))

// 判断一个数是奇数还是偶数
const isEven = num => num % 2 === 0
console.log(isEven(996))

// 指定位数四舍五入
const round = (num, d) => Number(Math.round(num + 'e' + d) + 'e-' + d)
console.log(round(1.005, 2))
console.log(round(1.555, 1))
